package lab02.test06;

public class Ladder {
    //属性:double的上底、下底、高、面积
    double top;
    double bottom;
    double height;
    double area;
    //行为:返回面积
    public double getArea() {
        double area=((top+bottom)*height)/2;
        System.out.println("梯形的面积："+area);
        return area;
    }

    public static void main(String[] args) {
        Ladder ladder=new Ladder();
        ladder.height=2;
        ladder.bottom=5;
        ladder.top=5;
        ladder.getArea();
    }
}
